package Kaobeishen;

public class main {
    public static void main(String[] args){
        try {
            Address originalAddress = new Address("北京","海淀大街");
            Student studentA = new Student("张三",1001,originalAddress);
            Student studentB = (Student) studentA.clone();
            System.out.println("原始学生A的住址：" + studentA.address.city);
            System.out.println("原始学生B的住址：" + studentB.address.city);
            System.out.println("---------------------------------");
            studentB.address.city = "上海";
            studentB.address.street = "浦东大道";
            System.out.println("修改后学生B的住址：" + studentB.address.city);
            System.out.println("---------------------------------");
            System.out.println("修改后学生A的住址：" + studentA.address.city);
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
        }
    }
}
